set term png
set yrange [-400:500]
set style line 1 lt rgb "red" lw 2 pt 5
set style line 2 lt rgb "violet" lw 2 pt 6
set style line 3 lt rgb "blue" lw 2 pt 7
set style line 4 lt rgb "green" lw 2 pt 8
set grid noxtics ytics
set key left box
set ylabel "Speedup (%)"

set tmargin 0
set bmargin 0
set lmargin 3
set rmargin 3

do for [datfile in "nenem-plot-bb nenem-plot-pb nenem-plot-rd"] {
set output datfile.".png"

set multiplot layout 2,1

set size 0.9,0.4375
set origin 0.075,0.5625

unset title
unset xlabel
unset xtics
set ytics (-400,-200,0,200,400)
plot datfile.".dat" using 2:3 title "1/3-1/4" with points ls 1, "" using 2:3 smooth sbezier with lines notitle ls 1, \
     datfile.".dat" using 2:5 title "2/3-2/4" with points ls 3, "" using 2:5 smooth sbezier with lines notitle ls 3

set size 0.9,0.4375
set origin 0.075,0.125

set xtics 0,20,100
set xlabel "Graph density (%)" 
plot datfile.".dat" using 2:4:xticlabels(7) title "2/3-1/3" with points ls 2, "" using 2:4 smooth sbezier with lines notitle ls 2, \
     datfile.".dat" using 2:6 title "2/4-1/4" with points ls 4, "" using 2:6 smooth sbezier with lines notitle ls 4

unset multiplot
}

set size 0.9,0.875
set origin 0.075,0.125

set xtics 0,20,100
set xlabel "Graph density (%)" 

do for [datfile in "nenem-plot-pb nenem-plot-rd"] {
set output datfile."-bb.png"
plot datfile."-bb.dat" using 2:3:xticlabels(7) title "1/3" with points ls 1, "" using 2:3 smooth sbezier with lines notitle ls 1, \
datfile."-bb.dat" using 2:4 title "1/4" with points ls 2, "" using 2:4 smooth sbezier with lines notitle ls 2, \
datfile."-bb.dat" using 2:5 title "2/3" with points ls 3, "" using 2:5 smooth sbezier with lines notitle ls 3, \
datfile."-bb.dat" using 2:6 title "2/4" with points ls 4, "" using 2:6 smooth sbezier with lines notitle ls 4
}
set output "nenem-plot-rd-pb.png"
plot "nenem-plot-rd-pb.dat" using 2:3:xticlabels(7) title "1/3" with points ls 1, "" using 2:3 smooth sbezier with lines notitle ls 1, \
"nenem-plot-rd-pb.dat" using 2:4 title "1/4" with points ls 2, "" using 2:4 smooth sbezier with lines notitle ls 2, \
"nenem-plot-rd-pb.dat" using 2:5 title "2/3" with points ls 3, "" using 2:5 smooth sbezier with lines notitle ls 3, \
"nenem-plot-rd-pb.dat" using 2:6 title "2/4" with points ls 4, "" using 2:6 smooth sbezier with lines notitle ls 4
set output "nenem-plot-rd-pb-randdens.png"
plot "nenem-plot-rd-pb-randdens.dat" using 2:3:xticlabels(7) title "1/3" with points ls 1, "" using 2:3 smooth sbezier with lines notitle ls 1, \
"nenem-plot-rd-pb-randdens.dat" using 2:4 title "1/4" with points ls 2, "" using 2:4 smooth sbezier with lines notitle ls 2, \
"nenem-plot-rd-pb-randdens.dat" using 2:5 title "2/3" with points ls 3, "" using 2:5 smooth sbezier with lines notitle ls 3, \
"nenem-plot-rd-pb-randdens.dat" using 2:6 title "2/4" with points ls 4, "" using 2:6 smooth sbezier with lines notitle ls 4
